Assignment 8
Due date : September 24, Midnight EST
Total Marks : 10
Today’s Exercise
Topics |
Lab Exercises |
Points |
Random Class |
|
|
Important Note:
· Work with your partner collaboratively. This means that you must not divide the work between the two of you. You will work together.
· Work on one computer only. If two computers are open, it will be assumed that you have divided the work and only half of the total grade will be given.
· Only one partner should upload all assignment files. The other partner will upload only the declaration form.
· Make sure that the program compiles and runs without any error. A program with compiler or runtime error will receive no credit.
· When you work on today’s problem set, get help from the following websites.
§ http://java.sun.com/j2se/1.4.2/docs/api/java/util/Random.html
Rolling Dice
Write a complete Java program that simulates the rolling of a pair of dice. For each die in the pair, the program should generate a random number between 1 and 6 (inclusive). It should print out the result of the roll for each die and the total roll (the sum of the two dice), all appropriately labeled. You must use the Random class. You may look at RandomNumbers.java – the example program from Chapter 3 in “Example Programs” folder in CougarView.